/*
 *  Copyright 2020-2025 the original author or authors.
 *  You cannot use this file unless authorized by the author.
 */

package org.ipig.search.es;

/**
 * ES支持的字段数据类型
 *
 * @author <a href="mailto:comchnts@163.com">chinats</a>
 * @version $$Id$$
 * @since 1.0
 */
public class FieldDataTypes {
    //数据类型关键字
    public static final String TYPE="type";
    /**
     * 特定类型
     */
    public enum Specialised {
        IP("ip", "IPv4 and IPv6"),
        TOKEN_COUNT("token_count", "计算字符串中的令牌数"),
        JOIN("join", "父子关联关系");
        //code
        private final String code;
        //title
        private final String title;

        Specialised(String code, String title) {
            this.code = code;
            this.title = title;
        }

        public String getCode() {
            return code;
        }

        public String getTitle() {
            return title;
        }
    }

    /**
     * 地理位置类型
     */
    public enum Geo {
        GEO_POINT("geo_point", "地理点数据类型-纬度/经度点的地理位置"),
        GEO_SHAPE("geo_shape", "地理形状数据类型-几何图形用于复杂形状，如多边形");
        //code
        private final String code;
        //title
        private final String title;

        Geo(String code, String title) {
            this.code = code;
            this.title = title;
        }

        public String getCode() {
            return code;
        }

        public String getTitle() {
            return title;
        }
    }

    /**
     * 复杂数据类型
     */
    public enum Complex {
        ARRAY("array", "数组类型"),
        OBJECT("object", "对象类型"),
        NESTED("nested", "嵌套类型");
        //code
        private final String code;
        //title
        private final String title;

        Complex(String code, String title) {
            this.code = code;
            this.title = title;
        }

        public String getCode() {
            return code;
        }

        public String getTitle() {
            return title;
        }
    }

    /**
     * 核心数据类型
     */
    public enum Core {
        STRING_TEXT("text", "字符型-text"),
        STRING_KEYWORD("keyword", "字符型-keyword"),
        NUMERIC_LONG("long", "数字类型-long"),
        NUMERIC_INTEGER("integer", "数字类型-integer"),
        NUMERIC_SHORT("short", "数字类型-short"),
        NUMERIC_BYTE("byte", "数字类型-byte"),
        NUMERIC_DOUBLE("double", "数字类型-double"),
        NUMERIC_FLOAT("float", "数字类型-float"),
        NUMERIC_HALF_FLOAT("half_float", "数字类型-half_float"),
        NUMERIC_SCALED_FLOAT("scaled_float", "数字类型-scaled_float"),
        DATE("date", "日期类型-精确到微秒"),
        DATE_NANOS("date_nanos", "日期类型-精确到纳秒"),
        BOOLEAN("boolean", "布尔类型"),
        BINARY("binary", "二进制类型"),
        RANGE_INTEGER("integer_range", "范围类型-integer"),
        RANGE_FLOAT("float_range", "范围类型-float"),
        RANGE_LONG("long_range", "范围类型-long"),
        RANGE_DOUBLE("double_range", "范围类型-double"),
        RANGE_DATE("date_range", "范围类型-date");
        //code
        private final String code;
        //title
        private final String title;

        Core(String code, String title) {
            this.code = code;
            this.title = title;
        }

        public String getCode() {
            return code;
        }

        public String getTitle() {
            return title;
        }
    }
}